#/
# @license Apache-2.0
#
# Copyright (c) 2017 The Stdlib Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#/

# DEPENDENCIES #

include $(TOOLS_MAKE_LIB_DIR)/test/javascript.mk


# RULES #

#/
# Runs unit tests.
#
# ## Notes
#
# -   This command is useful when wanting to glob for test files (e.g., run all tests for a particular package).
#
#
# @param {string} [TESTS_FILTER] - file path pattern (e.g., `.*/blas/base/dasum/.*`)
# @param {*} [FAST_FAIL] - flag indicating whether to stop running tests upon encountering a test failure
#
# @example
# make test
#
# @example
# make test TESTS_FILTER=".*/blas/base/dasum/.*"
#/
test: test-local

.PHONY: test

#/
# Runs a specified list of files containing unit tests.
#
# ## Notes
#
# -   This rule is useful when wanting to run a list of test files generated by some other command (e.g., a list of changed test files obtained via `git diff`).
#
#
# @param {string} FILES - list of test file paths
# @param {*} [FAST_FAIL] - flag indicating whether to stop running tests upon encountering a test failure
#
# @example
# make test-files FILES='/foo/test.js /bar/test.js'
#/
test-files: test-files-local

.PHONY: test-files

#/
# Runs unit tests in the local environment.
#
# ## Notes
#
# -   This rule is useful when wanting to run a list of test files generated by some other command (e.g., a list of changed test files obtained via `git diff`).
# -   In this context, "local" refers to the local development environment, as opposed to running in a headless browser or on CI.
#
#
# @param {string} [TESTS_FILTER] - file path pattern (e.g., `.*/blas/base/dasum/.*`
# @param {*} [FAST_FAIL] - flag indicating whether to stop running tests upon encountering a test failure)
#
# @example
# make test-local
#
# @example
# make test-local TESTS_FILTER=".*/blas/base/dasum/.*"
#/
test-local: test-javascript-local

.PHONY: test-local

#/
# Runs, in the local environment, a specified list of files containing unit tests.
#
# ## Notes
#
# -   In this context, "local" refers to the local development environment, as opposed to running in a headless browser or on CI.
# -   This rule is useful when wanting to run a list of test files generated by some other command (e.g., a list of changed test files obtained via `git diff`).
#
#
# @param {string} FILES - list of test file paths
# @param {*} [FAST_FAIL] - flag indicating whether to stop running tests upon encountering a test failure
#
# @example
# make test-files-local FILES='/foo/test.js /bar/test.js'
#/
test-files-local: test-javascript-files-local

.PHONY: test-files-local

#/
# Runs unit tests and summarizes aggregated TAP output.
#
# ## Notes
#
# -   This command is useful when wanting to glob for test files (e.g., run all tests for a particular package).
#
#
# @param {string} [TESTS_FILTER] - file path pattern (e.g., `.*/blas/base/dasum/.*`)
# @param {*} [FAST_FAIL] - flag indicating whether to stop running tests upon encountering a test failure
#
# @example
# make test-summary
#
# @example
# make test-summary TESTS_FILTER=".*/blas/base/dasum/.*"
#/
test-summary: test-javascript-summary

.PHONY: test-summary

#/
# Runs a specified list of files containing unit tests and summarizes aggregated TAP output.
#
# ## Notes
#
# -   This rule is useful when wanting to run a list of test files generated by some other command (e.g., a list of changed test files obtained via `git diff`).
#
#
# @param {string} FILES - list of test file paths
# @param {*} [FAST_FAIL] - flag indicating whether to stop running tests upon encountering a test failure
#
# @example
# make test-files-summary FILES='/foo/test.js /bar/test.js'
#/
test-files-summary: test-javascript-files-summary

.PHONY: test-files-summary

#/
# Runs unit tests and minimizes aggregated TAP output.
#
# ## Notes
#
# -   This command is useful when wanting to glob for test files (e.g., run all tests for a particular package).
#
#
# @param {string} [TESTS_FILTER] - file path pattern (e.g., `.*/blas/base/dasum/.*`)
# @param {*} [FAST_FAIL] - flag indicating whether to stop running tests upon encountering a test failure
#
# @example
# make test-min
#
# @example
# make test-min TESTS_FILTER=".*/blas/base/dasum/.*"
#/
test-min: test-javascript-min

.PHONY: test-min

#/
# Runs a specified list of files containing unit tests and minimizes aggregated TAP output.
#
# ## Notes
#
# -   This rule is useful when wanting to run a list of test files generated by some other command (e.g., a list of changed test files obtained via `git diff`).
#
#
# @param {string} FILES - list of test file paths
# @param {*} [FAST_FAIL] - flag indicating whether to stop running tests upon encountering a test failure
#
# @example
# make test-files-min FILES='/foo/test.js /bar/test.js'
#/
test-files-min: test-javascript-files-min

.PHONY: test-files-min

#/
# Runs unit tests and generates raw TAP output.
#
# ## Notes
#
# -   This command is useful when wanting to glob for test files (e.g., run all tests for a particular package).
#
#
# @param {string} [TESTS_FILTER] - file path pattern (e.g., `.*/blas/base/dasum/.*`)
# @param {*} [FAST_FAIL] - flag indicating whether to stop running tests upon encountering a test failure
#
# @example
# make test-tap
#
# @example
# make test-tap TESTS_FILTER=".*/blas/base/dasum/.*"
#/
test-tap: test-javascript-tap

.PHONY: test-tap

#/
# Runs a specified list of files containing unit tests and generates raw TAP output.
#
# ## Notes
#
# -   This rule is useful when wanting to run a list of test files generated by some other command (e.g., a list of changed test files obtained via `git diff`).
#
#
# @param {string} FILES - list of test file paths
# @param {*} [FAST_FAIL] - flag indicating whether to stop running tests upon encountering a test failure
#
# @example
# make test-files-tap FILES='/foo/test.js /bar/test.js'
#/
test-files-tap: test-javascript-files-tap

.PHONY: test-files-tap

#/
# Runs unit tests and converts TAP output to xUnit XML.
#
# ## Notes
#
# -   This command is useful when wanting to glob for test files (e.g., run all tests for a particular package).
#
#
# @param {string} [TESTS_FILTER] - file path pattern (e.g., `.*/blas/base/dasum/.*`)
# @param {*} [FAST_FAIL] - flag indicating whether to stop running tests upon encountering a test failure
#
# @example
# make test-xunit
#
# @example
# make test-xunit TESTS_FILTER=".*/blas/base/dasum/.*"
#/
test-xunit: test-javascript-xunit

.PHONY: test-xunit

#/
# Runs a specified list of files containing unit tests and converts TAP output to xUnit XML.
#
# ## Notes
#
# -   This rule is useful when wanting to run a list of test files generated by some other command (e.g., a list of changed test files obtained via `git diff`).
#
#
# @param {string} FILES - list of test file paths
# @param {*} [FAST_FAIL] - flag indicating whether to stop running tests upon encountering a test failure
#
# @example
# make test-files-xunit FILES='/foo/test.js /bar/test.js'
#/
test-files-xunit: test-javascript-files-xunit

.PHONY: test-files-xunit
